<template>
  <div>
    <!-- 面包屑导航条 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>数据中心</el-breadcrumb-item>
      <el-breadcrumb-item>客户管理</el-breadcrumb-item>
      <el-breadcrumb-item>当前联系人</el-breadcrumb-item>
    </el-breadcrumb>
    <!--用于添加卡片（整体展示）-->
    <el-card class="box-card">

      <div slot="header" class="clearfix">
        <el-button style="float: right; padding: 3px 0" icon="el-icon-close" circle @click="toList">返回</el-button>
      </div>

      <!--列表展示 :data是数据绑定 从后台获取的返回数据进行赋值-->
      <el-table
        :data="linKen"
        style="width: 100%">
        <!--一列的字段 label(需要修改)是上面的行名称 prop（需要修改）是绑定的后台数据-->
        <el-table-column
          prop="id"
          label=""
          width="90">
          <!--<template slot-scope="scope">
            {{scope.$index+1}}
          </template>-->
        </el-table-column>
        <el-table-column
          prop="name"
          label="名称"
          width="150">
        </el-table-column>
        <el-table-column
          prop="sex"
          label="性别"
          width="150">
          <template slot-scope="scope">
            {{scope.row.sex|sexFit}}
          </template>
        </el-table-column>
        <el-table-column
          prop="tel"
          label="电话"
          width="170">
        </el-table-column>
        <el-table-column
          prop="email"
          label="邮箱"
          width="170">
        </el-table-column>
        <el-table-column
          prop="recvAddress"
          label="收件地址"
          width="170">
        </el-table-column>
        <el-table-column
          prop="position"
          label="职位"
          width="150">
          <template slot-scope="scope">
            {{scope.row.position|positionFit}}
          </template>
        </el-table-column>
        <el-table-column
          prop="remarks"
          label="描述"
          width="150">
        </el-table-column>
      </el-table>
    </el-card>

  </div>
</template>

<script>
    export default {
        name: "CustLinKen",
      data(){
          return{
            linKen:[]
          }
      },
      methods:{
        getLinKen:function (id) {
          this.$http.get("/customer/toLinken/"+id).then((res)=>{
            this.linKen=res.data.result;
        })
        },
        toList:function () {
          this.$router.push("/customer")
        }
      },
      filters:{
        positionFit:function (val) {
          if (val=="0"){
            return "董事长";
          }
          if (val=="1"){
            return "经理";
          }
          if (val=="2"){
            return "组长";
          }
          if (val=="3"){
            return "销售";
          }
          if (val=="4"){
            return "工艺员";
          }
        },
        sexFit:function (val) {
          if (val=="0"){
            return "男";
          }
          if (val=="1"){
            return "女";
          }
        }
      },
      mounted(){
        var id = this.$route.query.id;
        this.getLinKen(id);
        alert(id)
      }
    }
</script>

<style scoped>

</style>
